package com.kucai.yifaqapp.presenter.fragment;

import com.kucai.yifaqapp.global.HttpAdress;
import com.kucai.yifaqapp.model.CustomObserver;
import com.kucai.yifaqapp.model.network.HttpJsonUtils;
import com.kucai.yifaqapp.model.network.entity.res.Pay_CzListBean;
import com.kucai.yifaqapp.ui.fragment.InsertMoneyFragment;
import com.kucai.yifaqapp.util.SYSOUtils;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

public class InsertMoneyFragmentPresenter extends BaseFragmentPresenter<InsertMoneyFragment> {


    public InsertMoneyFragmentPresenter(InsertMoneyFragment mFragment) {
        super(mFragment);
    }


    //获取充值列表
    public void getCzList(String token) {
        HttpJsonUtils.getHttpApiInstance()
                .getCzList( HttpAdress.getuseAdress() + "api/m/user/getPayList",token)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new CustomObserver<Pay_CzListBean>(mFragment) {

                    @Override
                    protected void onCustomNext(Pay_CzListBean resBanner) {
                        mFragment.onGetCzList(resBanner);
                    }

                    @Override
                    protected void onSubscribeCustom(Disposable disposable) {
                    }

                    @Override
                    protected void onErrorCustom(Throwable e) {
                        SYSOUtils.sOut(e.toString());
                    }
                });
    }
}